package com.rykj.ruiyan_ptz.wiget

import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.view.View
import android.widget.RelativeLayout
import androidx.annotation.RequiresApi
import com.rykj.common.utils.RYLogger
import com.rykj.ruiyan_ptz.R
import kotlinx.android.synthetic.main.small_status.view.*

@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
class SmallStatus
@JvmOverloads
constructor(context: Context, attrs: AttributeSet, defStyle: Int = 0, defStyleRes: Int = 0) :
    RelativeLayout(context, attrs, defStyle, defStyleRes) {
    init {
        View.inflate(context, R.layout.small_status, this)
        init()
    }

    private fun init() {
        initClickListener()
    }

    private fun initClickListener() {
        changeCamera.setOnClickListener {
            RYLogger.i("SmallStatus", "切换镜头")
        }
        fullScreen.setOnClickListener {
            RYLogger.i("SmallStatus", "切换全屏")
        }
    }

    fun setText(status: String) {
        main_status_text.text = status
    }
}